#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int list[200005];
int vis[200005]={0};
FILE *fin,*fout;
int pt(){
	int i=1;
	//int ok[100005];
	int nk;
	while(i<=n){
		if(vis[i]!=1){
			nk=list[i];
			vis[i]=1;
			fprintf(fout,"%d ",i);
			break;
		}
		i++;
	}
	i=1;
	//int nk=list[1];
	while(i<=n){
		if(vis[i]==1){
			i++;
			continue;
		}
		if(list[i]!=nk){
			fprintf(fout,"%d ",i);
			nk=list[i];
			vis[i]=1;
		}
		i++;
	}
}
bool notend(){
	for(int i=1;i<=n;i++){
		if(vis[i]==0){
			return true;
		}
	}
	return false;
}
int main(){
	//FILE *fin,*fout;
	fin=fopen("fruit.in","rb");
	fout=fopen("fruit.out","wb");
	//fin=stdin,fout=stdout;
	fscanf(fin,"%d",&n);
	list[0]=114514;
	for(int i=1;i<=n;i++){
		fscanf(fin,"%d",&list[i]);
	}
	while(notend()){
		pt();
		fprintf(fout,"\n");
	}
	fclose(fin);
	fclose(fout);
	return 0;
} 
